/**
 * Created by ly on 16-4-7 上午9:31
 * Copyright (c) 2016 SAIZ.CN. All rights reserved.
 */

package com.example.adapter;

import android.view.LayoutInflater;
import android.view.View;

public class AdapterHolder implements Cloneable {
    private int layout;

    public AdapterHolder(int layout) {
        this.layout = layout;
    }

    public final View afterPropertiesSet(LayoutInflater inflater) {
        View view = inflater.inflate(layout, null);
        view.setTag(cloneHolder());
        return view;
    }

    public void requestLayout(View view) {

    }

    /**
     * 绑定事件（可选）
     */
    public void bindEvent() {
    }

    /**
     * 绑定值（可选）
     */
    public void bindValues(int position) {
    }

    protected AdapterHolder cloneHolder() {
        try {
            return (AdapterHolder) super.clone();
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }
}
